package com.lhn.factory;

import com.lhn.dao.UserDao;
import com.lhn.dao.impl.UserDaoImpl;
import org.springframework.beans.factory.FactoryBean;

/**
 * @author lhn
 * @date 2024-08-16 15:54
 */

public class UserDaoFactoryBean implements FactoryBean<UserDao> {

    //代替原始实例工厂创建实例
    @Override
    public UserDao getObject() throws Exception {
        System.out.println("user dao factory bean setup ...");
        return new UserDaoImpl();
    }

    @Override
    public Class<?> getObjectType() {
        return UserDao.class;
    }

    @Override
    public boolean isSingleton() {
        return false;
    }
}
